Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

685
Visualizações
SQL Error [1525] [HY000]: Incorrect DATETIME value: ''

I get the error SQL Error [1525] [HY000]: Incorrect DATETIME value: '' when running following query:

SELECT * FROM mytable where date_time_column >=''

The query was working for the past few months and it started giving the above error since yesterday.

My MySQL version is 8.0.17.

I tried running the code via older versions of my code and still get the same error. Even trying it in MySQL Workbench gives the same error.

What Database config changes would have caused this?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

It's seems not related to database changes itself, but something changed in version 8.0.16 regarding comparison on DATETIME and TIMESTAMP types against strings. The behavior is documented already in 8.0.16 change log as following:

When comparing DATE values with constant strings, MySQL first tries to convert the string to a DATE and then to perform the comparison. When the conversion failed, MySQL executed the comparison treating the DATE as a string, which could lead to unpredictable behavior. Now in such cases, if the conversion of the string to a DATE fails, the comparison fails with ER_WRONG_VALUE. (Bug #29025656)

Also, this is reported as a bug here.

PD: Your query works on my old 5.7 MySQL version.

over 4 years ago · Santiago Trujillo Relatório

0

For me the issue was that a TRIGGER would try to update that same field after every update to a row.

The trigger would not use the correct format when making a comparison.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda